package com.cavy.platform.server.dto;

import com.cavy.platform.server.validator.PluginContainer;
import com.cavy.platform.server.validator.PluginContainerData;
import com.cavy.platform.server.validator.PluginExist;
import lombok.Data;

import javax.validation.Valid;
import javax.validation.constraints.NotNull;
import java.util.ArrayList;
import java.util.List;

/**
 * @author 唐旭
 * @Date 2018/7/18
 */
@Data
@PluginContainer(message = "容器信息验证失败")
public class ContainerInfoDto implements PluginContainerData {
    //镜像
    @NotNull(message = "镜像名称不能为空")
    protected String image;
    //命令
    protected String command;
    //运行插件的user
    protected String user;
    //挂载的卷
    @Valid
    protected List<ContainerVolumeDto> volumes = new ArrayList<>();
    //环境变量
    @Valid
    protected List<ContainerEnvironmentDto> environments = new ArrayList<>();
    //工作目录
    protected String workDir;

    //插件
    @PluginExist(message = "插件名称或版本错误")
    protected PluginPrimaryDto plugin;
    //依赖
    @Valid
    protected List<StageDependencyDto> dependencyList = new ArrayList<>();
    //是否允许失败
    protected boolean allowFailure = false;
}
